package siwi.map.android;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.PixelFormat;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.WindowManager;

import com.wmw.Utility.Common;
import com.wmw.Utility.DBConstant;
import com.wmw.Utility.DBConstant.DatabaseHelper;
import com.wmw.Utility.SRConstant;

public class Loading extends Activity {

	// time for picture display
	private static final int LOAD_DISPLAY_TIME = 1500;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		getWindow().setFormat(PixelFormat.RGBA_8888);
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
		setContentView(R.layout.loading);

		new Handler().postDelayed(new Runnable() {
			public void run() {
				// Go to main activity, and finish load activity
				Intent mainIntent = new Intent(Loading.this, Login.class);
				Loading.this.startActivity(mainIntent);
				Loading.this.finish();
				overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
			}
		}, LOAD_DISPLAY_TIME);

		initData();
	}

	private void initData() {
		ExApplication app = (ExApplication) getApplication();
		app._ImmdediateRing = SRConstant.getImmediateRingUri(this);
		app._DelayRing = SRConstant.getDelayRingUri(this);

//		app._openDBHelper = new DBConstant.DatabaseHelper(this);
//		DatabaseHelper dbHelper = app._openDBHelper;
//		DBConstant.createOrdersTables(dbHelper.getWritableDatabase());
//		app._ordersData.showItems(dbHelper.getReadableDatabase());
	}
}